home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / abstyles / aalpha.bst < prev    next >
Text File  |  1992-05-24  |  20KB  |  1,211 lines

  1. % BibTeX bibliography style `AALPHA'
  2. ENTRY
  3. { address
  4. author
  5. booktitle
  6. chapter
  7. edition
  8. editor
  9. howpublished
  10. institution
  11. journal
  12. key
  13. month
  14. note
  15. number
  16. organization
  17. pages
  18. publisher
  19. school
  20. series
  21. title
  22. type
  23. volume
  24. year
  25. }
  26. {}
  27. { label extra.label sort.label }
  28. INTEGERS { output.state before.all mid.sentence after.sentence after.block 
  29. continue.sentence }
  30. FUNCTION {init.state.consts}
  31. { #0 'before.all :=
  32. #1 'mid.sentence :=
  33. #2 'after.sentence :=
  34. #3 'after.block :=
  35. #4 'continue.sentence :=
  36. }
  37. STRINGS { s t }
  38. FUNCTION {output.nonnull}
  39. { 's :=
  40. output.state continue.sentence =
  41. { " " * write$ }
  42. { output.state mid.sentence =
  43. { ", " * write$ }
  44. { output.state after.block =
  45. { add.period$ write$
  46. newline$
  47. "\newblock " write$
  48. }
  49. { output.state before.all =
  50. 'write$
  51. { add.period$ " " * write$ }
  52. if$
  53. }
  54. if$
  55. }
  56. if$
  57. continue.sentence 'output.state :=
  58. }
  59. if$
  60. s
  61. }
  62. FUNCTION {output}
  63. { duplicate$ empty$
  64. 'pop$
  65. 'output.nonnull
  66. if$
  67. }
  68. FUNCTION {output.check}
  69. { 't :=
  70. duplicate$ empty$
  71. { pop$ "empty " t * " in " * cite$ * warning$ }
  72. 'output.nonnull
  73. if$
  74. }
  75. FUNCTION {output.bibitem}
  76. { newline$
  77. "\bibitem[" write$
  78. label write$
  79. "]{" write$
  80. cite$ write$
  81. "}" write$
  82. newline$
  83. ""
  84. before.all 'output.state :=
  85. }
  86. FUNCTION {fin.entry}
  87. { add.period$
  88. write$
  89. newline$
  90. }
  91. FUNCTION {new.block}
  92. { output.state before.all =
  93. 'skip$
  94. { after.block 'output.state := }
  95. if$
  96. }
  97. FUNCTION {new.sentence}
  98. { output.state after.block =
  99. 'skip$
  100. { output.state before.all =
  101. 'skip$
  102. { after.sentence 'output.state := }
  103. if$
  104. }
  105. if$
  106. }
  107. FUNCTION {new.clause}
  108. { output.state after.sentence =
  109. 'skip$
  110. { output.state after.block =
  111. 'skip$
  112. { output.state before.all =
  113. 'skip$
  114. { mid.sentence 'output.state := }
  115. if$
  116. }
  117. if$
  118. }
  119. if$
  120. }
  121. FUNCTION {not}
  122. {   { #0 }
  123. { #1 }
  124. if$
  125. }
  126. FUNCTION {and}
  127. {   'skip$
  128. { pop$ #0 }
  129. if$
  130. }
  131. FUNCTION {or}
  132. {   { pop$ #1 }
  133. 'skip$
  134. if$
  135. }
  136. FUNCTION {new.block.checka}
  137. { empty$
  138. 'skip$
  139. 'new.block
  140. if$
  141. }
  142. FUNCTION {new.block.checkb}
  143. { empty$
  144. swap$ empty$
  145. and
  146. 'skip$
  147. 'new.block
  148. if$
  149. }
  150. FUNCTION {new.sentence.checka}
  151. { empty$
  152. 'skip$
  153. 'new.sentence
  154. if$
  155. }
  156. FUNCTION {new.sentence.checkb}
  157. { empty$
  158. swap$ empty$
  159. and
  160. 'skip$
  161. 'new.sentence
  162. if$
  163. }
  164. FUNCTION {new.clause.checka}
  165. { empty$
  166. 'skip$
  167. 'new.clause
  168. if$
  169. }
  170. FUNCTION {new.clause.checkb}
  171. { empty$
  172. swap$ empty$
  173. and
  174. 'skip$
  175. 'new.clause
  176. if$
  177. }
  178. FUNCTION {field.or.null}
  179. { duplicate$ empty$
  180. { pop$ "" }
  181. 'skip$
  182. if$
  183. }
  184. FUNCTION {emphasize}
  185. { duplicate$ empty$
  186. { pop$ "" }
  187. { "\abtype{2}{" swap$ * "}" * }    
  188. if$
  189. }
  190. FUNCTION {capitalize}
  191. { duplicate$ empty$
  192. { pop$ "" }
  193. { "\abtype{0}{" swap$ * "}" * }    
  194. if$
  195. }
  196. FUNCTION {boldface}
  197. { duplicate$ empty$
  198. { pop$ "" }
  199. { "\abtype{3}{" swap$ * "}" * }    
  200. if$
  201. }
  202. FUNCTION {quote}
  203. { duplicate$ empty$
  204. { pop$ "" }
  205. { "\abtype{1}{" swap$ * "}" * }    
  206. if$
  207. }
  208. FUNCTION {parentheses}
  209. { duplicate$ empty$
  210. { pop$ "" }
  211. { "\abtype{5}{" swap$ * "}" * }    
  212. if$
  213. }
  214. INTEGERS { nameptr namesleft numnames }
  215. FUNCTION {format.names}
  216. { 's :=
  217. #1 'nameptr :=
  218. s num.names$ 'numnames :=
  219. numnames 'namesleft :=
  220. { namesleft #0 > }
  221. { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
  222. nameptr #1 >
  223. { namesleft #1 >
  224. { ", " * t * }
  225. { numnames #2 >
  226. { "\abphrase{1}" * }    
  227. 'skip$
  228. if$
  229. t "others" =
  230. { "\abphrase{2}" * }        
  231. { "\abphrase{0}" * t * }    
  232. if$
  233. }
  234. if$
  235. }
  236. 't
  237. if$
  238. nameptr #1 + 'nameptr :=
  239. namesleft #1 - 'namesleft :=
  240. }
  241. while$
  242. }
  243. FUNCTION {format.authors}
  244. { author empty$
  245. { "" }
  246. { author format.names capitalize }
  247. if$
  248. }
  249. FUNCTION {format.editors}
  250. { editor empty$
  251. { "" }
  252. { editor format.names capitalize
  253. editor num.names$ #1 >
  254. { "\abphrase{3}" * }    
  255. { "\abphrase{4}" * }    
  256. if$
  257. }
  258. if$
  259. }
  260. FUNCTION {format.title}
  261. { title empty$
  262. { "" }
  263. { title "t" change.case$ }
  264. if$
  265. }
  266. FUNCTION {n.dashify}
  267. { 't :=
  268. ""
  269. { t empty$ not }
  270. { t #1 #1 substring$ "-" =
  271. { t #1 #2 substring$ "--" = not
  272. { "--" *
  273. t #2 global.max$ substring$ 't :=
  274. }
  275. {   { t #1 #1 substring$ "-" = }
  276. { "-" *
  277. t #2 global.max$ substring$ 't :=
  278. }
  279. while$
  280. }
  281. if$
  282. }
  283. { t #1 #1 substring$ *
  284. t #2 global.max$ substring$ 't :=
  285. }
  286. if$
  287. }
  288. while$
  289. }
  290. FUNCTION {format.date}
  291. { year empty$
  292. { month empty$
  293. { "" }
  294. { "there's a month but no year in " cite$ * warning$
  295. month parentheses
  296. }
  297. if$
  298. }
  299. { month empty$
  300. { year parentheses }
  301. { month " " * year * parentheses }
  302. if$
  303. }
  304. if$
  305. }
  306. FUNCTION {format.btitle}
  307. { title quote
  308. }
  309. FUNCTION {tie.or.space.connect}
  310. { duplicate$ text.length$ #3 <
  311. { "~" }
  312. { " " }
  313. if$
  314. swap$ * *
  315. }
  316. FUNCTION {either.or.check}
  317. { empty$
  318. 'pop$
  319. { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  320. if$
  321. }
  322. FUNCTION {format.bvolume}
  323. { volume empty$
  324. { "" }
  325. { "\abphrase{8}" volume tie.or.space.connect    
  326. series empty$
  327. 'skip$
  328. { "\abphrase{5}" * series quote * }    
  329. if$
  330. "volume and number" number either.or.check
  331. }
  332. if$
  333. }
  334. FUNCTION {format.number.series}
  335. { volume empty$
  336. { number empty$
  337. { series field.or.null }
  338. { output.state mid.sentence = output.state continue.sentence = or
  339. { "\abphrase{10}" }    
  340. { "\abphrase{11}" }    
  341. if$
  342. number tie.or.space.connect
  343. series empty$
  344. { "there's a number but no series in " cite$ * warning$ }
  345. { "\abphrase{6}" * series * }    
  346. if$
  347. }
  348. if$
  349. }
  350. { "" }
  351. if$
  352. }
  353. FUNCTION {format.edition}
  354. { edition empty$
  355. { "" }
  356. { output.state mid.sentence = output.state continue.sentence = or
  357. { edition "l" change.case$ "\abphrase{12}" * }    
  358. { edition "t" change.case$ "\abphrase{12}" * }    
  359. if$
  360. }
  361. if$
  362. }
  363. INTEGERS { multiresult }
  364. FUNCTION {multi.page.check}
  365. { 't :=
  366. #0 'multiresult :=
  367. { multiresult not
  368. t empty$ not
  369. and
  370. }
  371. { t #1 #1 substring$
  372. duplicate$ "-" =
  373. swap$ duplicate$ "," =
  374. swap$ "+" =
  375. or or
  376. { #1 'multiresult := }
  377. { t #2 global.max$ substring$ 't := }
  378. if$
  379. }
  380. while$
  381. multiresult
  382. }
  383. FUNCTION {format.pages}
  384. { pages empty$
  385. { "" }
  386. { pages multi.page.check
  387. { "\abphrase{13}" pages n.dashify tie.or.space.connect }    
  388. { "\abphrase{14}" pages tie.or.space.connect }            
  389. if$
  390. }
  391. if$
  392. }
  393. FUNCTION {format.vol.num.pages}
  394. { volume field.or.null boldface
  395. number empty$
  396. 'skip$
  397. { "\abtype{4}{" number * "}" * *    
  398. volume empty$
  399. { "there's a number but no volume in " cite$ * warning$ }
  400. 'skip$
  401. if$
  402. }
  403. if$
  404. pages empty$
  405. 'skip$
  406. { duplicate$ empty$
  407. { pop$ format.pages }
  408. { ", " * pages n.dashify * }
  409. if$
  410. }
  411. if$
  412. }
  413. FUNCTION {format.chapter.pages}
  414. { chapter empty$
  415. 'format.pages
  416. { type empty$
  417. { "\abphrase{15}" }    
  418. { type "l" change.case$ }
  419. if$
  420. chapter tie.or.space.connect
  421. pages empty$
  422. 'skip$
  423. { ", " * format.pages * }
  424. if$
  425. }
  426. if$
  427. }
  428. FUNCTION {format.in.ed.booktitle}
  429. { booktitle empty$
  430. { "" }
  431. { editor empty$
  432. { "\abphrase{7}" booktitle quote * }                
  433. { "\abphrase{7}" format.editors * ", " * booktitle quote * }    
  434. if$
  435. }
  436. if$
  437. }
  438. FUNCTION {empty.misc.check}
  439. { author empty$ title empty$ howpublished empty$
  440. month empty$ year empty$ note empty$
  441. and and and and and
  442. key empty$ not and
  443. { "all relevant fields are empty in " cite$ * warning$ }
  444. 'skip$
  445. if$
  446. }
  447. FUNCTION {format.thesis.type}
  448. { type empty$
  449. 'skip$
  450. { pop$
  451. type "t" change.case$
  452. }
  453. if$
  454. }
  455. FUNCTION {format.tr.number}
  456. { type empty$
  457. { "\abphrase{16}" }    
  458. 'type
  459. if$
  460. number empty$
  461. { "t" change.case$ }
  462. { number tie.or.space.connect }
  463. if$
  464. }
  465. FUNCTION {format.article.crossref}
  466. { key empty$
  467. { journal empty$
  468. { "need key or journal for " cite$ * " to crossref " * crossref *
  469. warning$
  470. ""
  471. }
  472. { "\abphrase{7}" journal emphasize * }    
  473. if$
  474. }
  475. { "\abphrase{7}" key * }    
  476. if$
  477. " \cite{" * crossref * "}" *
  478. }
  479. FUNCTION {format.crossref.editor}
  480. { editor #1 "{vv~}{ll}" format.name$
  481. editor num.names$ duplicate$
  482. #2 >
  483. { pop$ "\abphrase{2}" * }    
  484. { #2 <
  485. 'skip$
  486. { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  487. { "\abphrase{2}" * }                     
  488. { "\abphrase{0}" * editor #2 "{vv~}{ll}" format.name$ * } 
  489. if$
  490. }
  491. if$
  492. }
  493. if$
  494. }
  495. FUNCTION {format.book.crossref}
  496. { volume empty$
  497. { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  498. "\abphrase{7}"                
  499. }
  500. { "\abphrase{9}" volume tie.or.space.connect    
  501. "\abphrase{5}" *                
  502. }
  503. if$
  504. editor empty$
  505. editor field.or.null author field.or.null =
  506. or
  507. { key empty$
  508. { series empty$
  509. { "need editor, key, or series for " cite$ * " to crossref " *
  510. crossref * warning$
  511. "" *
  512. }
  513. { series quote * }
  514. if$
  515. }
  516. { key * }
  517. if$
  518. }
  519. { format.crossref.editor * }
  520. if$
  521. " \cite{" * crossref * "}" *
  522. }
  523. FUNCTION {format.incoll.inproc.crossref}
  524. { editor empty$
  525. editor field.or.null author field.or.null =
  526. or
  527. { key empty$
  528. { booktitle empty$
  529. { "need editor, key, or booktitle for " cite$ * " to crossref " *
  530. crossref * warning$
  531. ""
  532. }
  533. { "\abphrase{7}" booktitle quote * }    
  534. if$
  535. }
  536. { "\abphrase{7}" key * }    
  537. if$
  538. }
  539. { "\abphrase{7}" format.crossref.editor * }    
  540. if$
  541. " \cite{" * crossref * "}" *
  542. }
  543. FUNCTION {article}
  544. { output.bibitem
  545. format.authors "author" output.check
  546. new.block
  547. format.title "title" output.check
  548. new.block
  549. crossref missing$
  550. { journal emphasize "journal" output.check
  551. format.vol.num.pages output
  552. format.date "year" output.check
  553. }
  554. { format.article.crossref output.nonnull
  555. new.clause
  556. format.pages output
  557. }
  558. if$
  559. new.block
  560. note output
  561. fin.entry
  562. }
  563. FUNCTION {book}
  564. { output.bibitem
  565. author empty$
  566. { format.editors "author and editor" output.check }
  567. { format.authors output.nonnull
  568. crossref missing$
  569. { "author and editor" editor either.or.check }
  570. 'skip$
  571. if$
  572. }
  573. if$
  574. new.block
  575. format.btitle "title" output.check
  576. crossref missing$
  577. { new.clause
  578. format.bvolume output
  579. new.block
  580. format.number.series output
  581. new.sentence
  582. publisher "publisher" output.check
  583. address new.clause.checka
  584. address output
  585. }
  586. { new.block
  587. format.book.crossref output.nonnull
  588. }
  589. if$
  590. edition new.clause.checka
  591. format.edition output
  592. format.date "year" output.check
  593. new.block
  594. note output
  595. fin.entry
  596. }
  597. FUNCTION {booklet}
  598. { output.bibitem
  599. format.authors output
  600. new.block
  601. format.title "title" output.check
  602. howpublished address new.block.checkb
  603. howpublished output
  604. address new.clause.checka
  605. address output
  606. format.date output
  607. new.block
  608. note output
  609. fin.entry
  610. }
  611. FUNCTION {inbook}
  612. { output.bibitem
  613. author empty$
  614. { format.editors "author and editor" output.check }
  615. { format.authors output.nonnull
  616. crossref missing$
  617. { "author and editor" editor either.or.check }
  618. 'skip$
  619. if$
  620. }
  621. if$
  622. new.block
  623. format.btitle "title" output.check
  624. new.clause
  625. crossref missing$
  626. { format.bvolume output
  627. new.clause
  628. format.chapter.pages "chapter and pages" output.check
  629. new.block
  630. format.number.series output
  631. new.sentence
  632. publisher "publisher" output.check
  633. address new.clause.checka
  634. address output
  635. }
  636. { format.chapter.pages "chapter and pages" output.check
  637. new.block
  638. format.book.crossref output.nonnull
  639. }
  640. if$
  641. edition new.clause.checka
  642. format.edition output
  643. format.date "year" output.check
  644. new.block
  645. note output
  646. fin.entry
  647. }
  648. FUNCTION {incollection}
  649. { output.bibitem
  650. format.authors "author" output.check
  651. new.block
  652. format.title "title" output.check
  653. new.block
  654. crossref missing$
  655. { format.in.ed.booktitle "booktitle" output.check
  656. new.clause
  657. format.bvolume output
  658. new.clause
  659. format.number.series output
  660. new.clause
  661. format.chapter.pages output
  662. new.sentence
  663. publisher "publisher" output.check
  664. address new.clause.checka
  665. address output
  666. edition new.clause.checka
  667. format.edition output
  668. format.date "year" output.check
  669. }
  670. { format.incoll.inproc.crossref output.nonnull
  671. new.clause
  672. format.chapter.pages output
  673. }
  674. if$
  675. new.block
  676. note output
  677. fin.entry
  678. }
  679. FUNCTION {inproceedings}
  680. { output.bibitem
  681. format.authors "author" output.check
  682. new.block
  683. format.title "title" output.check
  684. new.block
  685. crossref missing$
  686. { format.in.ed.booktitle "booktitle" output.check
  687. volume new.clause.checka
  688. format.bvolume output
  689. number series new.clause.checkb
  690. format.number.series output
  691. pages new.clause.checka
  692. format.pages output
  693. address empty$
  694. { organization publisher new.sentence.checkb
  695. organization output
  696. publisher new.clause.checka
  697. publisher output
  698. format.date "year" output.check
  699. }
  700. { new.clause
  701. address output.nonnull
  702. format.date "year" output.check
  703. new.sentence
  704. organization output
  705. new.clause
  706. publisher output
  707. }
  708. if$
  709. }
  710. { format.incoll.inproc.crossref output.nonnull
  711. new.clause
  712. format.pages output
  713. }
  714. if$
  715. new.block
  716. note output
  717. fin.entry
  718. }
  719. FUNCTION {conference} { inproceedings }
  720. FUNCTION {manual}
  721. { output.bibitem
  722. author empty$
  723. { organization empty$
  724. 'skip$
  725. { organization output.nonnull
  726. new.clause
  727. address output
  728. }
  729. if$
  730. }
  731. { format.authors output.nonnull }
  732. if$
  733. new.block
  734. format.btitle "title" output.check
  735. author empty$
  736. { organization empty$
  737. { address new.block.checka
  738. address output
  739. }
  740. 'skip$
  741. if$
  742. }
  743. { organization address new.block.checkb
  744. organization output
  745. address new.clause.checka
  746. address output
  747. }
  748. if$
  749. edition new.clause.checka
  750. format.edition output
  751. format.date output
  752. new.block
  753. note output
  754. fin.entry
  755. }
  756. FUNCTION {mastersthesis}
  757. { output.bibitem
  758. format.authors "author" output.check
  759. new.block
  760. format.title "title" output.check
  761. new.block
  762. "\abphrase{17}" format.thesis.type output.nonnull    
  763. new.clause
  764. school "school" output.check
  765. address new.clause.checka
  766. address output
  767. format.date "year" output.check
  768. new.block
  769. note output
  770. fin.entry
  771. }
  772. FUNCTION {misc}
  773. { output.bibitem
  774. format.authors output
  775. title howpublished new.block.checkb
  776. format.title output
  777. howpublished new.block.checka
  778. howpublished output
  779. format.date output
  780. new.block
  781. note output
  782. fin.entry
  783. empty.misc.check
  784. }
  785. FUNCTION {phdthesis}
  786. { output.bibitem
  787. format.authors "author" output.check
  788. new.block
  789. format.btitle "title" output.check
  790. new.block
  791. "\abphrase{18}" format.thesis.type output.nonnull    
  792. new.clause
  793. school "school" output.check
  794. address new.clause.checka
  795. address output
  796. format.date "year" output.check
  797. new.block
  798. note output
  799. fin.entry
  800. }
  801. FUNCTION {proceedings}
  802. { output.bibitem
  803. editor empty$
  804. { organization output }
  805. { format.editors output.nonnull }
  806. if$
  807. new.block
  808. format.btitle "title" output.check
  809. volume new.clause.checka
  810. format.bvolume output
  811. number series new.clause.checkb
  812. format.number.series output
  813. address empty$
  814. { editor empty$
  815. { publisher new.sentence.checka }
  816. { organization publisher new.sentence.checkb
  817. organization output
  818. publisher new.clause.checka
  819. }
  820. if$
  821. publisher output
  822. format.date "year" output.check
  823. }
  824. { new.clause
  825. address output.nonnull
  826. format.date "year" output.check
  827. new.sentence
  828. editor empty$
  829. 'skip$
  830. { organization output
  831. new.clause
  832. }
  833. if$
  834. publisher output
  835. }
  836. if$
  837. new.block
  838. note output
  839. fin.entry
  840. }
  841. FUNCTION {techreport}
  842. { output.bibitem
  843. format.authors "author" output.check
  844. new.block
  845. format.title "title" output.check
  846. new.block
  847. format.tr.number output.nonnull
  848. new.clause
  849. institution "institution" output.check
  850. address new.clause.checka
  851. address output
  852. format.date "year" output.check
  853. new.block
  854. note output
  855. fin.entry
  856. }
  857. FUNCTION {unpublished}
  858. { output.bibitem
  859. format.authors "author" output.check
  860. new.block
  861. format.title "title" output.check
  862. new.block
  863. note "note" output.check
  864. format.date output
  865. fin.entry
  866. }
  867. FUNCTION {default.type} { misc }
  868. MACRO {jan} {"\abmonth{1}"}
  869. MACRO {feb} {"\abmonth{2}"}
  870. MACRO {mar} {"\abmonth{3}"}
  871. MACRO {apr} {"\abmonth{4}"}
  872. MACRO {may} {"\abmonth{5}"}
  873. MACRO {jun} {"\abmonth{6}"}
  874. MACRO {jul} {"\abmonth{7}"}
  875. MACRO {aug} {"\abmonth{8}"}
  876. MACRO {sep} {"\abmonth{9}"}
  877. MACRO {oct} {"\abmonth{10}"}
  878. MACRO {nov} {"\abmonth{11}"}
  879. MACRO {dec} {"\abmonth{12}"}
  880. MACRO {first}   {"\abedition{1}"}
  881. MACRO {second}  {"\abedition{2}"}
  882. MACRO {third}   {"\abedition{3}"}
  883. MACRO {fourth}  {"\abedition{4}"}
  884. MACRO {fifth}   {"\abedition{5}"}
  885. MACRO {sixth}   {"\abedition{6}"}
  886. MACRO {seventh} {"\abedition{7}"}
  887. MACRO {eighth}  {"\abedition{8}"}
  888. MACRO {ninth}   {"\abedition{9}"}
  889. MACRO {tenth}   {"\abedition{10}"}
  890. MACRO {section}   {"\abchapter{0}"}
  891. MACRO {paragraph} {"\abchapter{1}"}
  892. MACRO {appendix}  {"\abchapter{2}"}
  893. MACRO {part}      {"\abchapter{3}"}
  894. READ
  895. FUNCTION {sortify}
  896. { purify$
  897. "l" change.case$
  898. }
  899. INTEGERS { len }
  900. FUNCTION {chop.word}
  901. { 's :=
  902. 'len :=
  903. s #1 len substring$ =
  904. { s len #1 + global.max$ substring$ }
  905. 's
  906. if$
  907. }
  908. INTEGERS { et.al.char.used }
  909. FUNCTION {initialize.et.al.char.used}
  910. { #0 'et.al.char.used :=
  911. }
  912. EXECUTE {initialize.et.al.char.used}
  913. FUNCTION {format.lab.names}
  914. { 's :=
  915. s num.names$ 'numnames :=
  916. numnames #1 >
  917. { numnames #4 >
  918. { #3 'namesleft := }
  919. { numnames 'namesleft := }
  920. if$
  921. #1 'nameptr :=
  922. ""
  923. { namesleft #0 > }
  924. { nameptr numnames =
  925. { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  926. { "{\etalchar{+}}" *
  927. #1 'et.al.char.used :=
  928. }
  929. { s nameptr "{v{}}{l{}}" format.name$ * }
  930. if$
  931. }
  932. { s nameptr "{v{}}{l{}}" format.name$ * }
  933. if$
  934. nameptr #1 + 'nameptr :=
  935. namesleft #1 - 'namesleft :=
  936. }
  937. while$
  938. numnames #4 >
  939. { "{\etalchar{+}}" *
  940. #1 'et.al.char.used :=
  941. }
  942. 'skip$
  943. if$
  944. }
  945. { s #1 "{v{}}{l{}}" format.name$
  946. duplicate$ text.length$ #2 <
  947. { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
  948. 'skip$
  949. if$
  950. }
  951. if$
  952. }
  953. FUNCTION {author.key.label}
  954. { author empty$
  955. { key empty$
  956. { cite$ #1 #3 substring$ }
  957. { key #3 text.prefix$ }
  958. if$
  959. }
  960. { author format.lab.names }
  961. if$
  962. }
  963. FUNCTION {author.editor.key.label}
  964. { author empty$
  965. { editor empty$
  966. { key empty$
  967. { cite$ #1 #3 substring$ }
  968. { key #3 text.prefix$ }
  969. if$
  970. }
  971. { editor format.lab.names }
  972. if$
  973. }
  974. { author format.lab.names }
  975. if$
  976. }
  977. FUNCTION {author.key.organization.label}
  978. { author empty$
  979. { key empty$
  980. { organization empty$
  981. { cite$ #1 #3 substring$ }
  982. { "The " #4 organization chop.word #3 text.prefix$ }
  983. if$
  984. }
  985. { key #3 text.prefix$ }
  986. if$
  987. }
  988. { author format.lab.names }
  989. if$
  990. }
  991. FUNCTION {editor.key.organization.label}
  992. { editor empty$
  993. { key empty$
  994. { organization empty$
  995. { cite$ #1 #3 substring$ }
  996. { "The " #4 organization chop.word #3 text.prefix$ }
  997. if$
  998. }
  999. { key #3 text.prefix$ }
  1000. if$
  1001. }
  1002. { editor format.lab.names }
  1003. if$
  1004. }
  1005. FUNCTION {calc.label}
  1006. { type$ "book" =
  1007. type$ "inbook" =
  1008. or
  1009. 'author.editor.key.label
  1010. { type$ "proceedings" =
  1011. 'editor.key.organization.label
  1012. { type$ "manual" =
  1013. 'author.key.organization.label
  1014. 'author.key.label
  1015. if$
  1016. }
  1017. if$
  1018. }
  1019. if$
  1020. duplicate$
  1021. year field.or.null purify$ #-1 #2 substring$
  1022. *
  1023. 'label :=
  1024. year field.or.null purify$ #-1 #4 substring$
  1025. *
  1026. sortify 'sort.label :=
  1027. }
  1028. FUNCTION {sort.format.names}
  1029. { 's :=
  1030. #1 'nameptr :=
  1031. ""
  1032. s num.names$ 'numnames :=
  1033. numnames 'namesleft :=
  1034. { namesleft #0 > }
  1035. { nameptr #1 >
  1036. { "   " * }
  1037. 'skip$
  1038. if$
  1039. s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
  1040. nameptr numnames = t "others" = and
  1041. { "et al" * }
  1042. { t sortify * }
  1043. if$
  1044. nameptr #1 + 'nameptr :=
  1045. namesleft #1 - 'namesleft :=
  1046. }
  1047. while$
  1048. }
  1049. FUNCTION {sort.format.title}
  1050. { 't :=
  1051. "A " #2
  1052. "An " #3
  1053. "The " #4 t chop.word
  1054. chop.word
  1055. chop.word
  1056. sortify
  1057. #1 global.max$ substring$
  1058. }
  1059. FUNCTION {author.sort}
  1060. { author empty$
  1061. { key empty$
  1062. { "to sort, need author or key in " cite$ * warning$
  1063. ""
  1064. }
  1065. { key sortify }
  1066. if$
  1067. }
  1068. { author sort.format.names }
  1069. if$
  1070. }
  1071. FUNCTION {author.editor.sort}
  1072. { author empty$
  1073. { editor empty$
  1074. { key empty$
  1075. { "to sort, need author, editor, or key in " cite$ * warning$
  1076. ""
  1077. }
  1078. { key sortify }
  1079. if$
  1080. }
  1081. { editor sort.format.names }
  1082. if$
  1083. }
  1084. { author sort.format.names }
  1085. if$
  1086. }
  1087. FUNCTION {author.organization.sort}
  1088. { author empty$
  1089. { organization empty$
  1090. { key empty$
  1091. { "to sort, need author, organization, or key in " cite$ * warning$
  1092. ""
  1093. }
  1094. { key sortify }
  1095. if$
  1096. }
  1097. { "The " #4 organization chop.word sortify }
  1098. if$
  1099. }
  1100. { author sort.format.names }
  1101. if$
  1102. }
  1103. FUNCTION {editor.organization.sort}
  1104. { editor empty$
  1105. { organization empty$
  1106. { key empty$
  1107. { "to sort, need editor, organization, or key in " cite$ * warning$
  1108. ""
  1109. }
  1110. { key sortify }
  1111. if$
  1112. }
  1113. { "The " #4 organization chop.word sortify }
  1114. if$
  1115. }
  1116. { editor sort.format.names }
  1117. if$
  1118. }
  1119. FUNCTION {presort}
  1120. { calc.label
  1121. sort.label
  1122. "    "
  1123. *
  1124. type$ "book" =
  1125. type$ "inbook" =
  1126. or
  1127. 'author.editor.sort
  1128. { type$ "proceedings" =
  1129. 'editor.organization.sort
  1130. { type$ "manual" =
  1131. 'author.organization.sort
  1132. 'author.sort
  1133. if$
  1134. }
  1135. if$
  1136. }
  1137. if$
  1138. *
  1139. "    "
  1140. *
  1141. year field.or.null sortify
  1142. *
  1143. "    "
  1144. *
  1145. title field.or.null
  1146. sort.format.title
  1147. *
  1148. #1 entry.max$ substring$
  1149. 'sort.key$ :=
  1150. }
  1151. ITERATE {presort}
  1152. SORT
  1153. STRINGS { longest.label last.sort.label next.extra }
  1154. INTEGERS { longest.label.width last.extra.num }
  1155. FUNCTION {initialize.longest.label}
  1156. { "" 'longest.label :=
  1157. #0 int.to.chr$ 'last.sort.label :=
  1158. "" 'next.extra :=
  1159. #0 'longest.label.width :=
  1160. #0 'last.extra.num :=
  1161. }
  1162. FUNCTION {forward.pass}
  1163. { last.sort.label sort.label =
  1164. { last.extra.num #1 + 'last.extra.num :=
  1165. last.extra.num int.to.chr$ 'extra.label :=
  1166. }
  1167. { "a" chr.to.int$ 'last.extra.num :=
  1168. "" 'extra.label :=
  1169. sort.label 'last.sort.label :=
  1170. }
  1171. if$
  1172. }
  1173. FUNCTION {reverse.pass}
  1174. { next.extra "b" =
  1175. { "a" 'extra.label := }
  1176. 'skip$
  1177. if$
  1178. label extra.label * 'label :=
  1179. label width$ longest.label.width >
  1180. { label 'longest.label :=
  1181. label width$ 'longest.label.width :=
  1182. }
  1183. 'skip$
  1184. if$
  1185. extra.label 'next.extra :=
  1186. }
  1187. EXECUTE {initialize.longest.label}
  1188. ITERATE {forward.pass}
  1189. REVERSE {reverse.pass}
  1190. FUNCTION {begin.bib}
  1191. {
  1192. "\newif\ifabfull\abfulltrue" write$ newline$
  1193. et.al.char.used
  1194. { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
  1195. 'skip$
  1196. if$
  1197. preamble$ empty$
  1198. 'skip$
  1199. { preamble$ write$ newline$ }
  1200. if$
  1201. "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
  1202. }
  1203. EXECUTE {begin.bib}
  1204. EXECUTE {init.state.consts}
  1205. ITERATE {call.type$}
  1206. FUNCTION {end.bib}
  1207. { newline$
  1208. "\end{thebibliography}" write$ newline$
  1209. }
  1210. EXECUTE {end.bib}
  1211.